<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8"/>
    <title>Functions: Task 4</title>
    <style>
      p {
        color: purple;
        margin: 0.5em 0;
      }

      * {
        box-sizing: border-box;
      }
    </style>
    <link rel="stylesheet" href="../styles.css" />
  </head>

  <body>

    <section class="preview">



    </section>

  </body>
  <script>
    const names = ['Chris', 'Li Kang', 'Anne', 'Francesca', 'Mustafa', 'Tina', 'Bert', 'Jada'];
    const para = document.createElement('p');

    function isShort(name) {
      return name.length < 5;
    }

    const shortNames = names.filter(isShort);
    para.textContent = shortNames;

    // Don't edit the code below here!

    const section = document.querySelector('section');

    section.appendChild(para);
  </script>

</html>
